#define _CRT_SECURE_NO_WARNINGS
#include "sort.h"
testQuickSort()
{
	//int arr[10] = { 3,1,2,4,0,9,7,8,6,5 };
	int arr[] = { 30,15,40,28,50,10,70 };
	int sz = sizeof(arr) / sizeof(arr[0]) - 1;
	QuickSort(arr, 0, sz);
	Print(arr, sz);
}
testHeapSort()
{
	//int arr[7] = {6,9,1,5,8,4,7};
	//int arr[] = { 1,9,2,8,3,7,4,6,0,5 };
	int arr[] = { -74, 48, -20, 2, 10, -84, -5, -9, 11, -24, -91, 2, -71, 64, 63, 80, 28, -30, -58, -11, -44, -87, -22, 54, -74, -10, -55, -28, -46, 29, 10, 50, -72, 34, 26, 25, 8, 51, 13, 30, 35, -8, 50, 65, -6, 16, -2, 21, -78, 35, -13, 14, 23, -3, 26, -90, 86, 25, -56, 91, -13, 92, -25, 37, 57, -20, -69, 98, 95, 45, 47, 29, 86, -28, 73, -44, -46, 65, -84, -96, -24, -12, 72, -68, 93, 57, 92, 52, -45, -2, 85, -63, 56, 55, 12, -85, 77, -39 };
	int sz = sizeof(arr) / sizeof(arr[0]) - 1;
	HeapSort(arr, sz);
	Print(arr, sz);
}
testGetMid()
{
	int arr[10] = { 3,1,2,4,0,9,7,8,6,5 };
	int sz = sizeof(arr) / sizeof(arr[0]) - 1;
	int key = GetMid(arr, 0, sz);
	printf("%d ", key);
}
int main()
{
	testQuickSort();
	//testHeapSort();
	//testGetMid();
	return 0;
}
void cmpsort(int a[], int b[], int n)
{
	int* count = (int*)malloc(sizeof(int) * n);
	for (int i = 0; i < n; i++) count[i] = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (a[i] <= a[j])
				count[j]++;
			else count[i]++;
		}
	}
	for (int i = 0; i < n; i++)
		b[count[i]] = a[i];
}
//int main()
//{
//	int a[] = { 20,-20,20,10,12,19 };
//	int b[6] = { 0 };
//	cmpsort(a, b, 6);
//	for (int i = 0; i < 6; i++)
//		printf("%d ", b[i]);
//	return 0;
//}